package com.kingtao.entry;

import com.kingtao.util.Sha256Util;

/**
 * @Author: kingtao
 * @Date: 2023-07-24-10:02
 * @Description:
 */
public class LogEntry {

    //  索引
    private int index;

    //  存储内容
    private String value;

    //  索引哈希
    private String preIndex;

    public LogEntry() {
        index = 0;
        value = null;
        this.preIndex = Sha256Util.getSHA256("0");
    }

    public LogEntry(String value) {
        this.value = value;
        this.preIndex = Sha256Util.getSHA256("0");
    }

    public LogEntry(int index, String value) {
        this.index = index;
        this.value = value;
        this.preIndex = Sha256Util.getSHA256("0");
    }

    public LogEntry(int index, String value, String preIndex) {
        this.index = index;
        this.value = value;
        this.preIndex = preIndex;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getPreIndex() {
        return preIndex;
    }

    public void setPreIndex(String preIndex) {
        this.preIndex = preIndex;
    }

    @Override
    public String toString() {
        return index + "," + value + "," + preIndex ;
    }

}
